package com.tanhua.sso.controller;

import com.tanhua.common.service.PicUploadService;
import com.tanhua.common.vo.PicUploadResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Auther: you
 * @Date: 2021/05/25/15:18
 * @Description:
 */
@Slf4j
@RestController
@RequestMapping("pic")
public class PicUploadController {
    @Autowired
    private PicUploadService picUploadService;

    //TODO  why @RequestParam("file")MultipartFile multipartFile???
    @PostMapping("upload") //请求体中携带有 图片文件，要使用MultipartFile multipartFile 接收
    public PicUploadResult upload(@RequestParam("file")MultipartFile multipartFile) {
        return picUploadService.upload(multipartFile);
    }
}
